package com.bit.captcha;

import cn.hutool.captcha.CaptchaUtil;
import cn.hutool.captcha.CircleCaptcha;
import cn.hutool.captcha.LineCaptcha;
import com.bit.captcha.model.CaptchaProperties;
import lombok.val;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Controller;

@Component
public class CaptchaTest {
    @Autowired
    private static CaptchaProperties captchaProperties;
    public static void test(){
        String s = captchaProperties.getSession().getKey();
        System.out.println(s);
    }
    public static void main(String[] args) {
        test();
//        LineCaptcha lineCaptcha = CaptchaUtil.createLineCaptcha(200, 100);
//
////图形验证码写出，可以写出到文件，也可以写出到流
//        lineCaptcha.write("d:/line.png");
//        System.out.println(lineCaptcha.getCode());
//        System.out.println(lineCaptcha.verify("1234"));
//        //定义图形验证码的长、宽、验证码字符数、干扰元素个数
//        CircleCaptcha captcha = CaptchaUtil.createCircleCaptcha(200, 100, 4, 20);
////CircleCaptcha captcha = new CircleCaptcha(200, 100, 4, 20);
////图形验证码写出，可以写出到文件，也可以写出到流
//        captcha.write("d:/circle.png");
////验证图形验证码的有效性，返回boolean值
//        captcha.verify("1234");


    }
}
